﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _1._9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
          
            Initial();
        }

      
        private void Initial()
        {
          
            pictureBox1.Size = new Size(120, 120);
        
            pictureBox1.Left = 0;
        
            pictureBox1.Top = this.ClientSize.Height - pictureBox1.Height;
         
            pictureBox1.Image = Image.FromFile("balloon.png");
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; 
        }

       
        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            button1.Enabled = false; 
        }

     
        private void timer1_Tick(object sender, EventArgs e)
        {
        
            pictureBox1.Left += 5;
            pictureBox1.Top -= 5;
         
            pictureBox1.Width -= 2;
            pictureBox1.Height -= 2;

           
            if (pictureBox1.Left > this.ClientSize.Width || pictureBox1.Top < 0 || pictureBox1.Width <= 0 || pictureBox1.Height <= 0)
            {
                timer1.Enabled = false; 
                Initial(); 
                button1.Enabled = true; 
            }
        }
    }
}